#列表处理
bicycles = ['trek', 'cannondale', 'redline', 'specialized']
print(bicycles)
print(bicycles[0].title)
print(bicycles[-1])
tran = ['motor', 'car', 'train', 'plane']
message = f"I would like to a {tran[0]}"
print(message)
motorcycle = ['honda', 'yamaha', 'suzuki']
print(motorcycle)
motorcycle[0] = 'ducati'
print(motorcycle)

#append()
motorcycle.append('ducati')
print(motorcycle)

#insert()
motorcycle.insert(0, 'posche')
del motorcycle[0]

#pop()
popped_motorcycle = motorcycle.pop()
print(popped_motorcycle)

#remove()
motorcycle.remove('yamaha')
print(motorcycle)

#sort()
motorcycle.sort(reverse=True)
print(motorcycle)
print(sorted(motorcycle))

#reverse()
motorcycle.reverse()
print(motorcycle)
print(len(motorcycle))

#遍历列表
pizzas = ['Italy', 'china', 'moscow']
for pizza in pizzas:
    print(f"I like {pizza}")
print("I really like pizza")

#创建列表
for value in range(1,5):
    print(value)
numbers = list(range(1, 6))
print(numbers)
even_numbers = list(range(2, 11, 2))
print(even_numbers)
squares = []
for value in range(1, 11):
    square = value**2
    squares.append(square)
print(squares)

#常用方法
min(squares)
max(squares)
sum(squares)

#列表表达式
squares = [value**2 for value in range(1, 11)]
print(squares)
plus = []
for value in range(1, 1_000_001):
    print(value)
    plus.append(value)
print(sum(plus))
for value in range(3, 30, 3):
    print(value)
clo = [value**3 for value in range(1,11)]
print(clo)

#索引
player = ['charles', 'martina', 'michael', 'florence', 'eli']
print(player[0:3])
my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]
print("my favorite food are:")
print(my_foods)
print(friend_foods)
